﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class PauseScene : MonoBehaviour
{
    public AudioSource audioSource;
    public GameObject Continue;
    public GameObject Back;
    public GameObject Sound_Control;
    //bool IsGamePaused;
    private void Start()
    {
        Continue.SetActive(false);
        Back.SetActive(false);
        Sound_Control.SetActive(false);
    }
    void FixedUpdate()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            PauseGame();
        }
    }
    //public void Back_to_Stage()
    //{
    //    Time.timeScale = 1;
    //    SceneManager.LoadScene("StageSelect");
    //}
    
    public void ContinueGame()
    {
        audioSource.Play();
        Continue.SetActive(false);
        Back.SetActive(false);
        Sound_Control.SetActive(false);
        //IsGamePaused = false;
        Time.timeScale = 1;
    }
    public void PauseGame()
    {
        audioSource.Pause();
        Continue.SetActive(true);
        Back.SetActive(true);
        Sound_Control.SetActive(true);
        //IsGamePaused = true;
        Time.timeScale = 0;
    }

}
